
const { createProxyMiddleware: proxy } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    proxy('/api', {
      target: 'http://localhost:9000',
      secure: false,
      changeOrigin: true,
      pathRewrite: {
        "^/api/": "/"
      }
    }));

  app.use(
    proxy('/ws', {
      target: 'http://localhost:9000',
      ws: false,
      changeOrigin: true,
      logLevel: 'debug' // 可选：查看代理日志
    }));
  webSocketServer: false;
}